<?php include "../public/header.php";?>
<?php include "../public/header_show.php";?>
<body id="xiangqingPage">
<div id="xiangqingBox">
    <div class="page-title">
        <div class="page-title-con">
            <span class="pageshowtitle">详情</span>
            <div class="page-title-opt-list">
                <?php include "../public_flow/flow_show_optbut.php";?>
                <button class="layui-btn layui-btn-sm btn-light marginr5 opt">
                    操作<i class="layui-icon layui-icon-down layui-font-12"></i>
                </button>
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
    <div class="main-container">

        <div><?php include "../public_flow/flow_show_info.php";?></div>


        <div class="table-box tablenes">
            <div class="title"><span>基本信息</span><span onclick="go_to_engin_xiang()" class="colorlan" style="float: right;margin-right: 12px">查看工程概况</span></div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">工程名称</td><td id="enginname" class="tv colorlan"></td><td class="tt">工程负责人</td><td id="gofuer" class="tv"></td></tr>
                </tbody>
            </table>
        </div>
        <div class="table-box tablenes">
            <div class="title">票税信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">工程采购合同金额(元)</td><td class="tv" id="caifee"></td><td class="tt">工程采购合同结算金额(元)</td><td class="tv" id="caijiefee"></td></tr>
                <tr><td class="tt">工程进项票金额(元)</td><td class="tv" id="piaoshoufee"></td><td class="tt">工程进项税额(元)</td><td class="tv" id="piaoshouratefee"></td></tr>
                <tr><td class="tt">工程销项票金额(元)</td><td class="tv" id="piaokaifee"></td><td class="tt">工程销项税额(元)</td><td class="tv" id="piaokairatefee"></td></tr>
                <tr><td class="tt">应收取税款保证金(元)</td><td class="tv" id="yingkoushuifee"></td><td class="tt">已收取税款保证金(元)</td><td class="tv" id="yikoushuifee"></td></tr>
                <tr><td class="tt">待收取税款保证金(元)</td><td class="tv" id="daikoushuifee"></td><td class="tt">工程累计抵扣进项税额(元)</td><td class="tv" id="leigongshuifee"></td></tr>
                </tbody>
            </table>
        </div>

        <div class="table-box tablenes">
            <div class="title">抵扣进项税额信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">本次抵扣进项税额(元)</td><td class="tv" id="money"></td><td class="tt">款项类型</td><td class="tv" id="zhiqilei_name"></td></tr>
                <tr><td class="tt">累计抵扣进项税额含本次(元)</td><td class="tv" id="leifee" colspan="3"></td></tr>
                <tr><td class="tt">认证日期</td><td id="rendt" class="tv"></td><td class="tt">退税方式</td><td id="tuifang_name" class="tv"></td></tr>
                <tr><td class="tt">备注</td><td class="tv" id="explain" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>
<!--        <div class="table-box tablenes">-->
<!--            <div class="title">支付信息(出纳)</div>-->
<!--            <table class="layui-table">-->
<!--                <tbody>-->
<!--                <tr><td class="tt">支付状态</td><td class="tv" id="paystate_name"></td><td class="tt">最近支付日期</td><td class="tv" id="paylastdt"></td></tr>-->
<!--                <tr><td class="tt">已支付金额(元)</td><td class="tv" id="payfee"></td><td class="tt">未支付金额(元)</td><td class="tv" id="paynofee"></td></tr>-->
<!--                </tbody>-->
<!--            </table>-->
<!--        </div>-->

        <div><?php include "../public/upinfo_show.php";?></div>

        <div><?php include "../public_flow/flow_show_flowrelas.php";?></div>

        <div class="table-box tablenes">
            <script type="text/html" id="toolbarDemo">抵扣明细</script>
            <div class="tableShow">
                <table id="datalist" lay-filter="datalist"></table>
            </div>
        </div>

        <div class="table-box tablenes">
            <script type="text/html" id="toolbarDemo_fu">付款明细</script>
            <div class="tableShow">
                <table id="datalist_fu" lay-filter="datalist_fu"></table>
            </div>
        </div>


        <div><?php include '../public_flow/flow_show_shenlog.php'?></div>
        <div><?php include '../public_flow/flow_show_talk.php'?></div>
        <div><?php include '../public/opt_browse.php'?></div>
    </div>
</div>
<script>
    var param_id = getQueryVariable('id') || 0;
    var pub_enginid;
    layui.use(['form', 'layer', "laytp",'element','dropdown','laypage','table','soulTable'], function() {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable,element = layui.element;

        facade.ajax({url: ask_hou_gongshui_show, data:{id: param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                var engininfo = res.data.engininfo;

                if(engininfo){
                    pub_enginid = engininfo.id
                    $("#enginname").text(engininfo.name).click(function () {
                        openPage('../engin/show.php?id='+engininfo.id);
                    });
                    $("#gofuer").text(engininfo.gofuer);

                    $('#caifee').text(parseFormatNum(engininfo.caifee));
                    $('#caijiefee').text(parseFormatNum(engininfo.caijiefee));
                    $('#piaoshoufee').text(parseFormatNum(engininfo.piaoshoufee));
                    $('#piaoshouratefee').text(parseFormatNum(engininfo.piaoshouratefee));
                    $('#piaokaifee').text(parseFormatNum(engininfo.piaokaifee));
                    $('#piaokairatefee').text(parseFormatNum(engininfo.piaokairatefee));
                    $('#yingkoushuifee').text(parseFormatNum(engininfo.yingkoushuifee));
                    $('#yikoushuifee').text(parseFormatNum(engininfo.yikoushuifee));
                    $('#daikoushuifee').text(parseFormatNum(engininfo.daikoushuifee));
                    $('#leigongshuifee').text(parseFormatNum(engininfo.leigongshuifee));
                }



                $("#money").text(parseFormatNum(data.money));
                $("#leifee").text(parseFormatNum(data.leifee));
                $("#rendt").text(data.rendt);
                $("#tuifang_name").text(data.tuifang_name);
                $("#zhiqilei_name").text(data.zhiqilei_name);
                $("#explain").text(data.explain);

                if(data.tuifang == 1){
                    $(".tuifanginfo").removeClass('layui-hide');
                }



                var kuaninfo = res.data.kuaninfo;
                if(kuaninfo){
                    $("#paystate_name").text(kuaninfo.paystate_name);
                    $("#paylastdt").text(kuaninfo.paylastdt);
                    $("#payfee").text(parseFormatNum(kuaninfo.payfee)).addClass('colorlan').click(function () {
                        openNavPage('查看交易明细信息','account_list/index.php?kuanid='+kuaninfo.id);
                    });
                    $("#paynofee").text(parseFormatNum(kuaninfo.paynofee));
                }



                var mytableList = table.render({
                    elem: "#datalist",data:res.data.list, toolbar: '#toolbarDemo', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text,totalRow: true
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号',totalRowText: '合计'}
                        ,{field: 'xiaoer', title: '销售方名称'}
                        ,{field:'gongzhifee',title:'累计支付销售方(元)',templet: function(d){return parseFormatNum(d.gongzhifee);}}
                        ,{field:'piaoshoufee',title:'销售方进项票累计(元)',templet: function(d){return parseFormatNum(d.piaoshoufee);}}
                        ,{field:'concaimoney',title:'已签采购合同金额(元)',templet: function(d){return parseFormatNum(d.concaimoney);}}
                        ,{field:'kedifee',title:'可抵扣进项票金额(元)',templet: function(d){return parseFormatNum(d.kedifee);}}
                        ,{field:'yidimoney',title:'已抵扣进项票价税合计(元)',templet: function(d){return parseFormatNum(d.yidimoney);}}
                        ,{field:'yidiratefee',title:'已抵扣进项税额(元)',templet: function(d){return parseFormatNum(d.yidiratefee);}}
                        ,{field:'shengdifee',title:'剩余可抵扣进项票金额(元)',templet: function(d){return parseFormatNum(d.shengdifee);}}
                        ,{field:'money',title:'本次抵扣进项票价税合计(元)',templet: function(d){return parseFormatNum(d.money);}}
                        ,{field:'ratefee',title:'本次抵扣税额(元)',templet: function(d){return parseFormatNum(d.ratefee);}}
                        ,{field: 'explain', title: '款项说明'}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });

                var futableList = table.render({
                    elem: "#datalist_fu",data:res.data.fu, toolbar: '#toolbarDemo_fu', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text,totalRow: true
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号',totalRowText: '合计'}
                        ,{field: 'fuer', title: '付款对象'}
                        ,{field: 'incdaotype_name', title: '支付方式'}
                        ,{field: 'bankzhang', title: '账户'}
                        ,{field: 'banknum', title: '账号'}
                        ,{field: 'bankname', title: '开户行'}
                        ,{field:'money',title:'本次支付抵扣税额(元)',templet: function(d){
                                return parseFormatNum(d.money);
                            }}
                        ,{field: 'explain', title: '款项说明'}
                        ,{field:'',title:'支付状态',templet: function(d){
                                if(d.kuaninfo){return d.kuaninfo.paystate_name;}
                                return '';
                            }}
                        ,{field:'',title:'已支付金额(元)',templet: function(d){
                                if(d.kuaninfo){
                                    return '<span class="colorlan" onclick="openNavPage(\'查看交易明细信息\',\'account_list/index.php?kuanid='+d.kuaninfo.id+'\')">'+parseFormatNum(d.kuaninfo.payfee)+'</span>';
                                }
                                return '';
                            }}
                        ,{field:'',title:'未支付金额(元)',templet: function(d){
                                if(d.kuaninfo){return parseFormatNum(d.kuaninfo.paynofee)}
                                return '';
                            }}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });

                public_flow_show_display(res.data.billinfo);
                public_upload_show_file('upload_files', res.data.files);
                render_from();
            }
        });

        public_get_readsandlog('hou_gongshui', param_id);
    });


    function show_chuinfo(chuid) {
        if(chuid > 0){
            openPage('../contract_chu/show.php?id='+chuid);
        }
    }

    function go_to_engin_xiang(){
        if(pub_enginid){
            openPage('../engin/xiang.php?id='+pub_enginid);

        }else{
            facade.error("暂无工程信息");return false;
        }
    }
</script>
</body>
</html>




